package lily.phs.diabet;

import lily.phs.database.Constants;
import lily.phs.object.DiabetService;
import lily.phs.object.HereTipa;
import lily.phs.urh.R;
import lily.ui.control.MyPopupWindow;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.LinearLayout.LayoutParams;

public class DiabetServiceView_2 extends LinearLayout implements Constants,
		OnClickListener, OnFocusChangeListener {

	private Context mContext;
	private EditText et_fbs_1,et_fbs_2,et_fbs_3,et_fbs_4,et_hemoglobin_1,et_hemoglobin_2,et_hemoglobin_3,et_hemoglobin_4,
	et_acce_exam_time_1,et_acce_exam_time_2,et_acce_exam_time_3,et_acce_exam_time_4,et_acce_exam_other_1,et_acce_exam_other_2,
	et_acce_exam_other_3,et_acce_exam_other_4,et_medicine_1_1,et_medicine_1_2,et_medicine_1_3,et_medicine_1_4,et_medi_1_usage_1,
	et_medi_1_usage_2,et_medi_1_usage_3,et_medi_1_usage_4,et_medi_1_dosage_1,et_medi_1_dosage_2,et_medi_1_dosage_3,
	et_medi_1_dosage_4,et_medicine_2_1,et_medicine_2_2,et_medicine_2_3,et_medicine_2_4,
	et_medi_2_usage_1,et_medi_2_usage_2,et_medi_2_usage_3,et_medi_2_usage_4,
	et_medi_2_dosage_1,et_medi_2_dosage_2,et_medi_2_dosage_3,et_medi_2_dosage_4,et_medicine_3_1,et_medicine_3_2,et_medicine_3_3,
	et_medicine_3_4,et_medi_3_usage_1,et_medi_3_usage_2,et_medi_3_usage_3,et_medi_3_usage_4,et_medi_3_dosage_1,
	et_medi_3_dosage_2,et_medi_3_dosage_3,et_medi_3_dosage_4,et_glucokinin_1,et_glucokinin_2,et_glucokinin_3,et_glucokinin_4,
	et_glucokinin_use_1,et_glucokinin_use_2,et_glucokinin_use_3,et_glucokinin_use_4,et_transfer_reason_1,et_transfer_reason_2,
	et_transfer_reason_3,et_transfer_reason_4,et_transfer_hospital_1,et_transfer_hospital_2,et_transfer_hospital_3,
	et_transfer_hospital_4,et_next_visit_time_1,et_next_visit_time_2,et_next_visit_time_3,et_next_visit_time_4,
	et_doctor_1,et_doctor_2,et_doctor_3,et_doctor_4;
	
	private RadioGroup rg_obedience_1,rg_obedience_2,rg_obedience_3,rg_obedience_4,rg_untoward_effect_1,rg_untoward_effect_2,
	rg_untoward_effect_3,rg_untoward_effect_4,rg_hypoglycemia_1,rg_hypoglycemia_2,rg_hypoglycemia_3,rg_hypoglycemia_4,
	rg_classify_1,rg_classify_2,rg_classify_3,rg_classify_4;
	
	private RadioButton rb_obedience_1_1,rb_obedience_1_2,rb_obedience_1_3,rb_obedience_2_1,rb_obedience_2_2,rb_obedience_2_3,
	rb_obedience_3_1,rb_obedience_3_2,rb_obedience_3_3,rb_obedience_4_1,rb_obedience_4_2,rb_obedience_4_3,rb_untoward_effect_1_1,
	rb_untoward_effect_1_2,rb_untoward_effect_2_1,rb_untoward_effect_2_2,rb_untoward_effect_3_1,rb_untoward_effect_3_2,
	rb_untoward_effect_4_1,rb_untoward_effect_4_2,rb_hypoglycemia_1_1,rb_hypoglycemia_1_2,rb_hypoglycemia_1_3,rb_hypoglycemia_2_1,
	rb_hypoglycemia_2_2,rb_hypoglycemia_2_3,rb_hypoglycemia_3_1,rb_hypoglycemia_3_2,rb_hypoglycemia_3_3,rb_hypoglycemia_4_1,
	rb_hypoglycemia_4_2,rb_hypoglycemia_4_3,rb_classify_1_1,rb_classify_1_2,rb_classify_1_3,rb_classify_1_4,rb_classify_2_1,
	rb_classify_2_2,rb_classify_2_3,rb_classify_2_4,rb_classify_3_1,rb_classify_3_2,rb_classify_3_3,rb_classify_3_4,
	rb_classify_4_1,rb_classify_4_2,rb_classify_4_3,rb_classify_4_4;
	
	private MyPopupWindow mPopupWindow;
	
	private HereTipa ht;
	private DiabetService diabet1,diabet2,diabet3,diabet4;
	private View child;
	private int profileId = 0;
	
	public DiabetServiceView_2(Context context,int profileid) {
		super(context);
		// TODO Auto-generated constructor stub
		this.mContext = context;
		this.profileId = profileid;
		
		final LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		child = inflater.inflate(R.layout.diabet_service_2, null);
	}
	
	/**
	 * 控件与xml文件关联
	 */
	public void findViewsById() {
		et_fbs_1 = (EditText)child.findViewById(R.id.fbs_1);
		et_fbs_2 = (EditText)child.findViewById(R.id.fbs_2);
		et_fbs_3 = (EditText)child.findViewById(R.id.fbs_3);
		et_fbs_4 = (EditText)child.findViewById(R.id.fbs_4);
		et_hemoglobin_1 = (EditText)child.findViewById(R.id.hemoglobin_1);
		et_hemoglobin_2 = (EditText)child.findViewById(R.id.hemoglobin_2);
		et_hemoglobin_3 = (EditText)child.findViewById(R.id.hemoglobin_3);
		et_hemoglobin_4 = (EditText)child.findViewById(R.id.hemoglobin_4);
		et_acce_exam_time_1 = (EditText)child.findViewById(R.id.acce_exam_time_1);
		et_acce_exam_time_2 = (EditText)child.findViewById(R.id.acce_exam_time_2);
		et_acce_exam_time_3 = (EditText)child.findViewById(R.id.acce_exam_time_3);
		et_acce_exam_time_4 = (EditText)child.findViewById(R.id.acce_exam_time_4);
		et_acce_exam_other_1 = (EditText)child.findViewById(R.id.acce_exam_other_1);
		et_acce_exam_other_2 = (EditText)child.findViewById(R.id.acce_exam_other_2);
		et_acce_exam_other_3 = (EditText)child.findViewById(R.id.acce_exam_other_3);
		et_acce_exam_other_4 = (EditText)child.findViewById(R.id.acce_exam_other_4);
		et_medicine_1_1 = (EditText)child.findViewById(R.id.medicine_1_1);
		et_medicine_1_2 = (EditText)child.findViewById(R.id.medicine_1_2);
		et_medicine_1_3 = (EditText)child.findViewById(R.id.medicine_1_3);
		et_medicine_1_4 = (EditText)child.findViewById(R.id.medicine_1_4);
		et_medi_1_usage_1 = (EditText)child.findViewById(R.id.medi_1_usage_1);
		et_medi_1_usage_2 = (EditText)child.findViewById(R.id.medi_1_usage_2);
		et_medi_1_usage_3 = (EditText)child.findViewById(R.id.medi_1_usage_3);
		et_medi_1_usage_4 = (EditText)child.findViewById(R.id.medi_1_usage_4);
		et_medi_1_dosage_1 = (EditText)child.findViewById(R.id.medi_1_dosage_1);
		et_medi_1_dosage_2 = (EditText)child.findViewById(R.id.medi_1_dosage_2);
		et_medi_1_dosage_3 = (EditText)child.findViewById(R.id.medi_1_dosage_3);
		et_medi_1_dosage_4 = (EditText)child.findViewById(R.id.medi_1_dosage_4);
		et_medicine_2_1 = (EditText)child.findViewById(R.id.medicine_2_1);
		et_medicine_2_2 = (EditText)child.findViewById(R.id.medicine_2_2);
		et_medicine_2_3 = (EditText)child.findViewById(R.id.medicine_2_3);
		et_medicine_2_4 = (EditText)child.findViewById(R.id.medicine_2_4);
		et_medi_2_usage_1 = (EditText)child.findViewById(R.id.medi_2_usage_1);
		et_medi_2_usage_2 = (EditText)child.findViewById(R.id.medi_2_usage_2);
		et_medi_2_usage_3 = (EditText)child.findViewById(R.id.medi_2_usage_3);
		et_medi_2_usage_4 = (EditText)child.findViewById(R.id.medi_2_usage_4);
		et_medi_2_dosage_1 = (EditText)child.findViewById(R.id.medi_2_dosage_1);
		et_medi_2_dosage_2 = (EditText)child.findViewById(R.id.medi_2_dosage_2);
		et_medi_2_dosage_3 = (EditText)child.findViewById(R.id.medi_2_dosage_3);
		et_medi_2_dosage_4 = (EditText)child.findViewById(R.id.medi_2_dosage_4);
		et_medicine_3_1 = (EditText)child.findViewById(R.id.medicine_3_1);
		et_medicine_3_2 = (EditText)child.findViewById(R.id.medicine_3_2);
		et_medicine_3_3 = (EditText)child.findViewById(R.id.medicine_3_3);
		et_medicine_3_4 = (EditText)child.findViewById(R.id.medicine_3_4);
		et_medi_3_usage_1 = (EditText)child.findViewById(R.id.medi_3_usage_1);
		et_medi_3_usage_2 = (EditText)child.findViewById(R.id.medi_3_usage_2);
		et_medi_3_usage_3 = (EditText)child.findViewById(R.id.medi_3_usage_3);
		et_medi_3_usage_4 = (EditText)child.findViewById(R.id.medi_3_usage_4);
		et_medi_3_dosage_1 = (EditText)child.findViewById(R.id.medi_3_dosage_1);
		et_medi_3_dosage_2 = (EditText)child.findViewById(R.id.medi_3_dosage_2);
		et_medi_3_dosage_3 = (EditText)child.findViewById(R.id.medi_3_dosage_3);
		et_medi_3_dosage_4 = (EditText)child.findViewById(R.id.medi_3_dosage_4);
		et_glucokinin_1 = (EditText)child.findViewById(R.id.glucokinin_1);
		et_glucokinin_2 = (EditText)child.findViewById(R.id.glucokinin_2);
		et_glucokinin_3 = (EditText)child.findViewById(R.id.glucokinin_3);
		et_glucokinin_4 = (EditText)child.findViewById(R.id.glucokinin_4);
		et_glucokinin_use_1 = (EditText)child.findViewById(R.id.glucokinin_use_1);
		et_glucokinin_use_2 = (EditText)child.findViewById(R.id.glucokinin_use_2);
		et_glucokinin_use_3 = (EditText)child.findViewById(R.id.glucokinin_use_3);
		et_glucokinin_use_4 = (EditText)child.findViewById(R.id.glucokinin_use_4);
		et_transfer_reason_1 = (EditText)child.findViewById(R.id.transfer_reason_1);
		et_transfer_reason_2 = (EditText)child.findViewById(R.id.transfer_reason_2);
		et_transfer_reason_3 = (EditText)child.findViewById(R.id.transfer_reason_3);
		et_transfer_reason_4 = (EditText)child.findViewById(R.id.transfer_reason_4);
		et_transfer_hospital_1 = (EditText)child.findViewById(R.id.transfer_hospital_1);
		et_transfer_hospital_2 = (EditText)child.findViewById(R.id.transfer_hospital_2);
		et_transfer_hospital_3 = (EditText)child.findViewById(R.id.transfer_hospital_3);
		et_transfer_hospital_4 = (EditText)child.findViewById(R.id.transfer_hospital_4);
		et_next_visit_time_1 = (EditText)child.findViewById(R.id.next_visit_time_1);
		et_next_visit_time_2 = (EditText)child.findViewById(R.id.next_visit_time_2);
		et_next_visit_time_3 = (EditText)child.findViewById(R.id.next_visit_time_3);
		et_next_visit_time_4 = (EditText)child.findViewById(R.id.next_visit_time_4);
		et_doctor_1 = (EditText)child.findViewById(R.id.doctor_1);
		et_doctor_2 = (EditText)child.findViewById(R.id.doctor_2);
		et_doctor_3 = (EditText)child.findViewById(R.id.doctor_3);
		et_doctor_4 = (EditText)child.findViewById(R.id.doctor_4);
		rg_obedience_1 = (RadioGroup)child.findViewById(R.id.obedience_1);
		rg_obedience_2 = (RadioGroup)child.findViewById(R.id.obedience_2);
		rg_obedience_3 = (RadioGroup)child.findViewById(R.id.obedience_3);
		rg_obedience_4 = (RadioGroup)child.findViewById(R.id.obedience_4);
		rg_untoward_effect_1 = (RadioGroup)child.findViewById(R.id.untoward_effect_1);
		rg_untoward_effect_2 = (RadioGroup)child.findViewById(R.id.untoward_effect_2);
		rg_untoward_effect_3 = (RadioGroup)child.findViewById(R.id.untoward_effect_3);
		rg_untoward_effect_4 = (RadioGroup)child.findViewById(R.id.untoward_effect_4);
		rg_hypoglycemia_1 = (RadioGroup)child.findViewById(R.id.hypoglycemia_1);
		rg_hypoglycemia_2 = (RadioGroup)child.findViewById(R.id.hypoglycemia_2);
		rg_hypoglycemia_3 = (RadioGroup)child.findViewById(R.id.hypoglycemia_3);
		rg_hypoglycemia_4 = (RadioGroup)child.findViewById(R.id.hypoglycemia_4);
		rg_classify_1 = (RadioGroup)child.findViewById(R.id.classify_1);
		rg_classify_2 = (RadioGroup)child.findViewById(R.id.classify_2);
		rg_classify_3 = (RadioGroup)child.findViewById(R.id.classify_3);
		rg_classify_4 = (RadioGroup)child.findViewById(R.id.classify_4);
		rb_obedience_1_1 = (RadioButton)child.findViewById(R.id.obedience_1_1);
		rb_obedience_1_2 = (RadioButton)child.findViewById(R.id.obedience_1_2);
		rb_obedience_1_3 = (RadioButton)child.findViewById(R.id.obedience_1_3);
		rb_obedience_2_1 = (RadioButton)child.findViewById(R.id.obedience_2_1);
		rb_obedience_2_2 = (RadioButton)child.findViewById(R.id.obedience_2_2);
		rb_obedience_2_3 = (RadioButton)child.findViewById(R.id.obedience_2_3);
		rb_obedience_3_1 = (RadioButton)child.findViewById(R.id.obedience_3_1);
		rb_obedience_3_2 = (RadioButton)child.findViewById(R.id.obedience_3_2);
		rb_obedience_3_3 = (RadioButton)child.findViewById(R.id.obedience_3_3);
		rb_obedience_4_1 = (RadioButton)child.findViewById(R.id.obedience_4_1);
		rb_obedience_4_2 = (RadioButton)child.findViewById(R.id.obedience_4_2);
		rb_obedience_4_3 = (RadioButton)child.findViewById(R.id.obedience_4_3);
		rb_untoward_effect_1_1 = (RadioButton)child.findViewById(R.id.untoward_effect_1_1);
		rb_untoward_effect_1_2 = (RadioButton)child.findViewById(R.id.untoward_effect_1_2);
		rb_untoward_effect_2_1 = (RadioButton)child.findViewById(R.id.untoward_effect_2_1);
		rb_untoward_effect_2_2 = (RadioButton)child.findViewById(R.id.untoward_effect_2_2);
		rb_untoward_effect_3_1 = (RadioButton)child.findViewById(R.id.untoward_effect_3_1);
		rb_untoward_effect_3_2 = (RadioButton)child.findViewById(R.id.untoward_effect_3_2);
		rb_untoward_effect_4_1 = (RadioButton)child.findViewById(R.id.untoward_effect_4_1);
		rb_untoward_effect_4_2 = (RadioButton)child.findViewById(R.id.untoward_effect_4_2);
		rb_hypoglycemia_1_1 = (RadioButton)child.findViewById(R.id.hypoglycemia_1_1);
		rb_hypoglycemia_1_2 = (RadioButton)child.findViewById(R.id.hypoglycemia_1_2);
		rb_hypoglycemia_1_3 = (RadioButton)child.findViewById(R.id.hypoglycemia_1_3);
		rb_hypoglycemia_2_1 = (RadioButton)child.findViewById(R.id.hypoglycemia_2_1);
		rb_hypoglycemia_2_2 = (RadioButton)child.findViewById(R.id.hypoglycemia_2_2);
		rb_hypoglycemia_2_3 = (RadioButton)child.findViewById(R.id.hypoglycemia_2_3);
		rb_hypoglycemia_3_1 = (RadioButton)child.findViewById(R.id.hypoglycemia_3_1);
		rb_hypoglycemia_3_2 = (RadioButton)child.findViewById(R.id.hypoglycemia_3_2);
		rb_hypoglycemia_3_3 = (RadioButton)child.findViewById(R.id.hypoglycemia_3_3);
		rb_hypoglycemia_4_1 = (RadioButton)child.findViewById(R.id.hypoglycemia_4_1);
		rb_hypoglycemia_4_2 = (RadioButton)child.findViewById(R.id.hypoglycemia_4_2);
		rb_hypoglycemia_4_3 = (RadioButton)child.findViewById(R.id.hypoglycemia_4_3);
		rb_classify_1_1 = (RadioButton)child.findViewById(R.id.classify_1_1);
		rb_classify_1_2 = (RadioButton)child.findViewById(R.id.classify_1_2);
		rb_classify_1_3 = (RadioButton)child.findViewById(R.id.classify_1_3);
		rb_classify_1_4 = (RadioButton)child.findViewById(R.id.classify_1_4);
		rb_classify_2_1 = (RadioButton)child.findViewById(R.id.classify_2_1);
		rb_classify_2_2 = (RadioButton)child.findViewById(R.id.classify_2_2);
		rb_classify_2_3 = (RadioButton)child.findViewById(R.id.classify_2_3);
		rb_classify_2_4 = (RadioButton)child.findViewById(R.id.classify_2_4);
		rb_classify_3_1 = (RadioButton)child.findViewById(R.id.classify_3_1);
		rb_classify_3_2 = (RadioButton)child.findViewById(R.id.classify_3_2);
		rb_classify_3_3 = (RadioButton)child.findViewById(R.id.classify_3_3);
		rb_classify_3_4 = (RadioButton)child.findViewById(R.id.classify_3_4);
		rb_classify_4_1 = (RadioButton)child.findViewById(R.id.classify_4_1);
		rb_classify_4_2 = (RadioButton)child.findViewById(R.id.classify_4_2);
		rb_classify_4_3 = (RadioButton)child.findViewById(R.id.classify_4_3);
		rb_classify_4_4 = (RadioButton)child.findViewById(R.id.classify_4_4);
	}
	
	/**
	 * 初始化views
	 */
	public void initViews() {
		// TODO Auto-generated method stub
		initialState();
		
		String temp = "";
		int it = -1;
		float ft = -1f;
		
		//第一次随访记录
		ft = diabet1.getDise_fbs();
		if(ft!=-1f){
			et_fbs_1.setText(String.valueOf(ft));
		}
		ft = diabet1.getDise_hemoglobin();
		if(ft!=-1f){
			et_hemoglobin_1.setText(String.valueOf(ft));
		}
		temp = diabet1.getDise_acce_exam_time();
		if(temp.length()>0){
			et_acce_exam_time_1.setText(temp);
		}
		temp = diabet1.getDise_acce_exam_other();
		if(temp.length()>0){
			et_acce_exam_other_1.setText(temp);
		}
		it = diabet1.getDise_obedience();
		switch(it){
		case 1:{
			rg_obedience_1.check(0);
			rb_obedience_1_1.setChecked(true);
			break;
		}
		case 2:{
			rg_obedience_1.check(1);
			rb_obedience_1_2.setChecked(true);
			break;
		}
		case 3:{
			rg_obedience_1.check(2);
			rb_obedience_1_3.setChecked(true);
			break;
		}
		}
		it = diabet1.getDise_untoward_effect();
		switch(it){
		case 1:{
			rg_untoward_effect_1.check(0);
			rb_untoward_effect_1_1.setChecked(true);
			break;
		}
		case 2:{
			rg_untoward_effect_1.check(1);
			rb_untoward_effect_1_2.setChecked(true);
			break;
		}
		}
		it = diabet1.getDise_hypoglycemia();
		switch(it){
		case 1:{
			rg_hypoglycemia_1.check(0);
			rb_hypoglycemia_1_1.setChecked(true);
			break;
		}
		case 2:{
			rg_hypoglycemia_1.check(1);
			rb_hypoglycemia_1_2.setChecked(true);
			break;
		}
		case 3:{
			rg_hypoglycemia_1.check(2);
			rb_hypoglycemia_1_3.setChecked(true);
			break;
		}
		}
		it = diabet1.getDise_classify();
		switch(it){
		case 1:{
			rg_classify_1.check(0);
			rb_classify_1_1.setChecked(true);
			break;
		}
		case 2:{
			rg_classify_1.check(1);
			rb_classify_1_2.setChecked(true);
			break;
		}
		case 3:{
			rg_classify_1.check(2);
			rb_classify_1_3.setChecked(true);
			break;
		}
		case 4:{
			rg_classify_1.check(3);
			rb_classify_1_4.setChecked(true);
			break;
		}
		}
		temp = diabet1.getDise_medicine_1();
		if(temp.length()>0){
			et_medicine_1_1.setText(temp);
		}
		it = diabet1.getDise_medi_1_usage();
		if(it!=-1){
			et_medi_1_usage_1.setText(String.valueOf(it));
		}
		ft = diabet1.getDise_medi_1_dosage();
		if(ft!=-1f){
			et_medi_1_dosage_1.setText(String.valueOf(ft));
		}
		temp = diabet1.getDise_medicine_2();
		if(temp.length()>0){
			et_medicine_2_1.setText(temp);
		}
		it = diabet1.getDise_medi_2_usage();
		if(it!=-1){
			et_medi_2_usage_1.setText(String.valueOf(it));
		}
		ft = diabet1.getDise_medi_2_dosage();
		if(ft!=-1f){
			et_medi_2_dosage_1.setText(String.valueOf(ft));
		}
		temp = diabet1.getDise_medicine_3();
		if(temp.length()>0){
			et_medicine_3_1.setText(temp);
		}
		it = diabet1.getDise_medi_3_usage();
		if(it!=-1){
			et_medi_3_usage_1.setText(String.valueOf(it));
		}
		ft = diabet1.getDise_medi_3_dosage();
		if(ft!=-1f){
			et_medi_3_dosage_1.setText(String.valueOf(ft));
		}
		temp = diabet1.getDise_glucokinin();
		if(temp.length()>0){
			et_glucokinin_1.setText(temp);
		}
		temp = diabet1.getDise_glucokinin_use();
		if(temp.length()>0){
			et_glucokinin_use_1.setText(temp);
		}
		temp = diabet1.getDise_transfer_reason();
		if(temp.length()>0){
			et_transfer_reason_1.setText(temp);
		}
		temp = diabet1.getDise_transfer_hospital();
		if(temp.length()>0){
			et_transfer_hospital_1.setText(temp);
		}
		temp = diabet1.getDise_next_visit_time();
		if(temp.length()>0){
			et_next_visit_time_1.setText(temp);
		}
		temp = diabet1.getDise_doctor();
		if(temp.length()>0){
			et_doctor_1.setText(temp);
		}
		
		//第二次随访记录
		ft = diabet2.getDise_fbs();
		if(ft!=-1f){
			et_fbs_2.setText(String.valueOf(ft));
		}
		ft = diabet2.getDise_hemoglobin();
		if(ft!=-1f){
			et_hemoglobin_2.setText(String.valueOf(ft));
		}
		temp = diabet2.getDise_acce_exam_time();
		if(temp.length()>0){
			et_acce_exam_time_2.setText(temp);
		}
		temp = diabet2.getDise_acce_exam_other();
		if(temp.length()>0){
			et_acce_exam_other_2.setText(temp);
		}
		it = diabet2.getDise_obedience();
		switch(it){
		case 1:{
			rg_obedience_2.check(0);
			rb_obedience_2_1.setChecked(true);
			break;
		}
		case 2:{
			rg_obedience_2.check(1);
			rb_obedience_2_2.setChecked(true);
			break;
		}
		case 3:{
			rg_obedience_2.check(2);
			rb_obedience_2_3.setChecked(true);
			break;
		}
		}
		it = diabet2.getDise_untoward_effect();
		switch(it){
		case 1:{
			rg_untoward_effect_2.check(0);
			rb_untoward_effect_2_1.setChecked(true);
			break;
		}
		case 2:{
			rg_untoward_effect_2.check(1);
			rb_untoward_effect_2_2.setChecked(true);
			break;
		}
		}
		it = diabet2.getDise_hypoglycemia();
		switch(it){
		case 1:{
			rg_hypoglycemia_2.check(0);
			rb_hypoglycemia_2_1.setChecked(true);
			break;
		}
		case 2:{
			rg_hypoglycemia_2.check(1);
			rb_hypoglycemia_2_2.setChecked(true);
			break;
		}
		case 3:{
			rg_hypoglycemia_2.check(2);
			rb_hypoglycemia_2_3.setChecked(true);
			break;
		}
		}
		it = diabet2.getDise_classify();
		switch(it){
		case 1:{
			rg_classify_2.check(0);
			rb_classify_2_1.setChecked(true);
			break;
		}
		case 2:{
			rg_classify_2.check(1);
			rb_classify_2_2.setChecked(true);
			break;
		}
		case 3:{
			rg_classify_2.check(2);
			rb_classify_2_3.setChecked(true);
			break;
		}
		case 4:{
			rg_classify_2.check(3);
			rb_classify_2_4.setChecked(true);
			break;
		}
		}
		temp = diabet2.getDise_medicine_1();
		if(temp.length()>0){
			et_medicine_1_2.setText(temp);
		}
		it = diabet2.getDise_medi_1_usage();
		if(it!=-1){
			et_medi_1_usage_2.setText(String.valueOf(it));
		}
		ft = diabet2.getDise_medi_1_dosage();
		if(ft!=-1f){
			et_medi_1_dosage_2.setText(String.valueOf(ft));
		}
		temp = diabet2.getDise_medicine_2();
		if(temp.length()>0){
			et_medicine_2_2.setText(temp);
		}
		it = diabet2.getDise_medi_2_usage();
		if(it!=-1){
			et_medi_2_usage_2.setText(String.valueOf(it));
		}
		ft = diabet2.getDise_medi_2_dosage();
		if(ft!=-1f){
			et_medi_2_dosage_2.setText(String.valueOf(ft));
		}
		temp = diabet2.getDise_medicine_3();
		if(temp.length()>0){
			et_medicine_3_2.setText(temp);
		}
		it = diabet2.getDise_medi_3_usage();
		if(it!=-1){
			et_medi_3_usage_2.setText(String.valueOf(it));
		}
		ft = diabet2.getDise_medi_3_dosage();
		if(ft!=-1f){
			et_medi_3_dosage_2.setText(String.valueOf(ft));
		}
		temp = diabet2.getDise_glucokinin();
		if(temp.length()>0){
			et_glucokinin_2.setText(temp);
		}
		temp = diabet2.getDise_glucokinin_use();
		if(temp.length()>0){
			et_glucokinin_use_2.setText(temp);
		}
		temp = diabet2.getDise_transfer_reason();
		if(temp.length()>0){
			et_transfer_reason_2.setText(temp);
		}
		temp = diabet2.getDise_transfer_hospital();
		if(temp.length()>0){
			et_transfer_hospital_2.setText(temp);
		}
		temp = diabet2.getDise_next_visit_time();
		if(temp.length()>0){
			et_next_visit_time_2.setText(temp);
		}
		temp = diabet2.getDise_doctor();
		if(temp.length()>0){
			et_doctor_2.setText(temp);
		}
		
		//第三次随访记录
		ft = diabet3.getDise_fbs();
		if(ft!=-1f){
			et_fbs_3.setText(String.valueOf(ft));
		}
		ft = diabet3.getDise_hemoglobin();
		if(ft!=-1f){
			et_hemoglobin_3.setText(String.valueOf(ft));
		}
		temp = diabet3.getDise_acce_exam_time();
		if(temp.length()>0){
			et_acce_exam_time_3.setText(temp);
		}
		temp = diabet3.getDise_acce_exam_other();
		if(temp.length()>0){
			et_acce_exam_other_3.setText(temp);
		}
		it = diabet3.getDise_obedience();
		switch(it){
		case 1:{
			rg_obedience_3.check(0);
			rb_obedience_3_1.setChecked(true);
			break;
		}
		case 2:{
			rg_obedience_3.check(1);
			rb_obedience_3_2.setChecked(true);
			break;
		}
		case 3:{
			rg_obedience_3.check(2);
			rb_obedience_3_3.setChecked(true);
			break;
		}
		}
		it = diabet3.getDise_untoward_effect();
		switch(it){
		case 1:{
			rg_untoward_effect_3.check(0);
			rb_untoward_effect_3_1.setChecked(true);
			break;
		}
		case 2:{
			rg_untoward_effect_3.check(1);
			rb_untoward_effect_3_2.setChecked(true);
			break;
		}
		}
		it = diabet3.getDise_hypoglycemia();
		switch(it){
		case 1:{
			rg_hypoglycemia_3.check(0);
			rb_hypoglycemia_3_1.setChecked(true);
			break;
		}
		case 2:{
			rg_hypoglycemia_3.check(1);
			rb_hypoglycemia_3_2.setChecked(true);
			break;
		}
		case 3:{
			rg_hypoglycemia_3.check(2);
			rb_hypoglycemia_3_3.setChecked(true);
			break;
		}
		}
		it = diabet3.getDise_classify();
		switch(it){
		case 1:{
			rg_classify_3.check(0);
			rb_classify_3_1.setChecked(true);
			break;
		}
		case 2:{
			rg_classify_3.check(1);
			rb_classify_3_2.setChecked(true);
			break;
		}
		case 3:{
			rg_classify_3.check(2);
			rb_classify_3_3.setChecked(true);
			break;
		}
		case 4:{
			rg_classify_3.check(3);
			rb_classify_3_4.setChecked(true);
			break;
		}
		}
		temp = diabet3.getDise_medicine_1();
		if(temp.length()>0){
			et_medicine_1_3.setText(temp);
		}
		it = diabet3.getDise_medi_1_usage();
		if(it!=-1){
			et_medi_1_usage_3.setText(String.valueOf(it));
		}
		ft = diabet3.getDise_medi_1_dosage();
		if(ft!=-1f){
			et_medi_1_dosage_3.setText(String.valueOf(ft));
		}
		temp = diabet3.getDise_medicine_2();
		if(temp.length()>0){
			et_medicine_2_3.setText(temp);
		}
		it = diabet3.getDise_medi_2_usage();
		if(it!=-1){
			et_medi_2_usage_3.setText(String.valueOf(it));
		}
		ft = diabet3.getDise_medi_2_dosage();
		if(ft!=-1f){
			et_medi_2_dosage_3.setText(String.valueOf(ft));
		}
		temp = diabet3.getDise_medicine_3();
		if(temp.length()>0){
			et_medicine_3_3.setText(temp);
		}
		it = diabet3.getDise_medi_3_usage();
		if(it!=-1){
			et_medi_3_usage_3.setText(String.valueOf(it));
		}
		ft = diabet3.getDise_medi_3_dosage();
		if(ft!=-1f){
			et_medi_3_dosage_3.setText(String.valueOf(ft));
		}
		temp = diabet3.getDise_glucokinin();
		if(temp.length()>0){
			et_glucokinin_3.setText(temp);
		}
		temp = diabet3.getDise_glucokinin_use();
		if(temp.length()>0){
			et_glucokinin_use_3.setText(temp);
		}
		temp = diabet3.getDise_transfer_reason();
		if(temp.length()>0){
			et_transfer_reason_3.setText(temp);
		}
		temp = diabet3.getDise_transfer_hospital();
		if(temp.length()>0){
			et_transfer_hospital_3.setText(temp);
		}
		temp = diabet3.getDise_next_visit_time();
		if(temp.length()>0){
			et_next_visit_time_3.setText(temp);
		}
		temp = diabet3.getDise_doctor();
		if(temp.length()>0){
			et_doctor_3.setText(temp);
		}
		
		//第四次随访记录
		ft = diabet4.getDise_fbs();
		if(ft!=-1f){
			et_fbs_4.setText(String.valueOf(ft));
		}
		ft = diabet4.getDise_hemoglobin();
		if(ft!=-1f){
			et_hemoglobin_4.setText(String.valueOf(ft));
		}
		temp = diabet4.getDise_acce_exam_time();
		if(temp.length()>0){
			et_acce_exam_time_4.setText(temp);
		}
		temp = diabet4.getDise_acce_exam_other();
		if(temp.length()>0){
			et_acce_exam_other_4.setText(temp);
		}
		it = diabet4.getDise_obedience();
		switch(it){
		case 1:{
			rg_obedience_4.check(0);
			rb_obedience_4_1.setChecked(true);
			break;
		}
		case 2:{
			rg_obedience_4.check(1);
			rb_obedience_4_2.setChecked(true);
			break;
		}
		case 3:{
			rg_obedience_4.check(2);
			rb_obedience_4_3.setChecked(true);
			break;
		}
		}
		it = diabet4.getDise_untoward_effect();
		switch(it){
		case 1:{
			rg_untoward_effect_4.check(0);
			rb_untoward_effect_4_1.setChecked(true);
			break;
		}
		case 2:{
			rg_untoward_effect_4.check(1);
			rb_untoward_effect_4_2.setChecked(true);
			break;
		}
		}
		it = diabet4.getDise_hypoglycemia();
		switch(it){
		case 1:{
			rg_hypoglycemia_4.check(0);
			rb_hypoglycemia_4_1.setChecked(true);
			break;
		}
		case 2:{
			rg_hypoglycemia_4.check(1);
			rb_hypoglycemia_4_2.setChecked(true);
			break;
		}
		case 3:{
			rg_hypoglycemia_4.check(2);
			rb_hypoglycemia_4_3.setChecked(true);
			break;
		}
		}
		it = diabet4.getDise_classify();
		switch(it){
		case 1:{
			rg_classify_4.check(0);
			rb_classify_4_1.setChecked(true);
			break;
		}
		case 2:{
			rg_classify_4.check(1);
			rb_classify_4_2.setChecked(true);
			break;
		}
		case 3:{
			rg_classify_4.check(2);
			rb_classify_4_3.setChecked(true);
			break;
		}
		case 4:{
			rg_classify_4.check(3);
			rb_classify_4_4.setChecked(true);
			break;
		}
		}
		temp = diabet4.getDise_medicine_1();
		if(temp.length()>0){
			et_medicine_1_4.setText(temp);
		}
		it = diabet4.getDise_medi_1_usage();
		if(it!=-1){
			et_medi_1_usage_4.setText(String.valueOf(it));
		}
		ft = diabet4.getDise_medi_1_dosage();
		if(ft!=-1f){
			et_medi_1_dosage_4.setText(String.valueOf(ft));
		}
		temp = diabet4.getDise_medicine_2();
		if(temp.length()>0){
			et_medicine_2_4.setText(temp);
		}
		it = diabet4.getDise_medi_2_usage();
		if(it!=-1){
			et_medi_2_usage_4.setText(String.valueOf(it));
		}
		ft = diabet4.getDise_medi_2_dosage();
		if(ft!=-1f){
			et_medi_2_dosage_4.setText(String.valueOf(ft));
		}
		temp = diabet4.getDise_medicine_3();
		if(temp.length()>0){
			et_medicine_3_4.setText(temp);
		}
		it = diabet4.getDise_medi_3_usage();
		if(it!=-1){
			et_medi_3_usage_4.setText(String.valueOf(it));
		}
		ft = diabet4.getDise_medi_3_dosage();
		if(ft!=-1f){
			et_medi_3_dosage_4.setText(String.valueOf(ft));
		}
		temp = diabet4.getDise_glucokinin();
		if(temp.length()>0){
			et_glucokinin_4.setText(temp);
		}
		temp = diabet4.getDise_glucokinin_use();
		if(temp.length()>0){
			et_glucokinin_use_4.setText(temp);
		}
		temp = diabet4.getDise_transfer_reason();
		if(temp.length()>0){
			et_transfer_reason_4.setText(temp);
		}
		temp = diabet4.getDise_transfer_hospital();
		if(temp.length()>0){
			et_transfer_hospital_4.setText(temp);
		}
		temp = diabet4.getDise_next_visit_time();
		if(temp.length()>0){
			et_next_visit_time_4.setText(temp);
		}
		temp = diabet4.getDise_doctor();
		if(temp.length()>0){
			et_doctor_4.setText(temp);
		}
	
	}
	
	/**
	 * 初始时状态：横线为空，所有选择项未选中
	 */
	private void initialState() {
		et_fbs_1.setText("");
		et_fbs_2.setText("");
		et_fbs_3.setText("");
		et_fbs_4.setText("");
		et_hemoglobin_1.setText("");
		et_hemoglobin_2.setText("");
		et_hemoglobin_3.setText("");
		et_hemoglobin_4.setText("");
		et_acce_exam_time_1.setText("");
		et_acce_exam_time_2.setText("");
		et_acce_exam_time_3.setText("");
		et_acce_exam_time_4.setText("");
		et_acce_exam_other_1.setText("");
		et_acce_exam_other_2.setText("");
		et_acce_exam_other_3.setText("");
		et_acce_exam_other_4.setText("");
		et_medicine_1_1.setText("");
		et_medicine_1_2.setText("");
		et_medicine_1_3.setText("");
		et_medicine_1_4.setText("");
		et_medi_1_usage_1.setText("");
		et_medi_1_usage_2.setText("");
		et_medi_1_usage_3.setText("");
		et_medi_1_usage_4.setText("");
		et_medi_1_dosage_1.setText("");
		et_medi_1_dosage_2.setText("");
		et_medi_1_dosage_3.setText("");
		et_medi_1_dosage_4.setText("");
		et_medicine_2_1.setText("");
		et_medicine_2_2.setText("");
		et_medicine_2_3.setText("");
		et_medicine_2_4.setText("");
		et_medi_2_usage_1.setText("");
		et_medi_2_usage_2.setText("");
		et_medi_2_usage_3.setText("");
		et_medi_2_usage_4.setText("");
		et_medi_2_dosage_1.setText("");
		et_medi_2_dosage_2.setText("");
		et_medi_2_dosage_3.setText("");
		et_medi_2_dosage_4.setText("");
		et_medicine_3_1.setText("");
		et_medicine_3_2.setText("");
		et_medicine_3_3.setText("");
		et_medicine_3_4.setText("");
		et_medi_3_usage_1.setText("");
		et_medi_3_usage_2.setText("");
		et_medi_3_usage_3.setText("");
		et_medi_3_usage_4.setText("");
		et_medi_3_dosage_1.setText("");
		et_medi_3_dosage_2.setText("");
		et_medi_3_dosage_3.setText("");
		et_medi_3_dosage_4.setText("");
		et_glucokinin_1.setText("");
		et_glucokinin_2.setText("");
		et_glucokinin_3.setText("");
		et_glucokinin_4.setText("");
		et_glucokinin_use_1.setText("");
		et_glucokinin_use_2.setText("");
		et_glucokinin_use_3.setText("");
		et_glucokinin_use_4.setText("");
		et_transfer_reason_1.setText("");
		et_transfer_reason_2.setText("");
		et_transfer_reason_3.setText("");
		et_transfer_reason_4.setText("");
		et_transfer_hospital_1.setText("");
		et_transfer_hospital_2.setText("");
		et_transfer_hospital_3.setText("");
		et_transfer_hospital_4.setText("");
		et_next_visit_time_1.setText("");
		et_next_visit_time_2.setText("");
		et_next_visit_time_3.setText("");
		et_next_visit_time_4.setText("");
		et_doctor_1.setText("");
		et_doctor_2.setText("");
		et_doctor_3.setText("");
		et_doctor_4.setText("");
		rb_obedience_1_1.setChecked(false);
		rb_obedience_1_2.setChecked(false);
		rb_obedience_1_3.setChecked(false);
		rb_obedience_2_1.setChecked(false);
		rb_obedience_2_2.setChecked(false);
		rb_obedience_2_3.setChecked(false);
		rb_obedience_3_1.setChecked(false);
		rb_obedience_3_2.setChecked(false);
		rb_obedience_3_3.setChecked(false);
		rb_obedience_4_1.setChecked(false);
		rb_obedience_4_2.setChecked(false);
		rb_obedience_4_3.setChecked(false);
		rb_untoward_effect_1_1.setChecked(false);
		rb_untoward_effect_1_2.setChecked(false);
		rb_untoward_effect_2_1.setChecked(false);
		rb_untoward_effect_2_2.setChecked(false);
		rb_untoward_effect_3_1.setChecked(false);
		rb_untoward_effect_3_2.setChecked(false);
		rb_untoward_effect_4_1.setChecked(false);
		rb_untoward_effect_4_2.setChecked(false);
		rb_hypoglycemia_1_1.setChecked(false);
		rb_hypoglycemia_1_2.setChecked(false);
		rb_hypoglycemia_1_3.setChecked(false);
		rb_hypoglycemia_2_1.setChecked(false);
		rb_hypoglycemia_2_2.setChecked(false);
		rb_hypoglycemia_2_3.setChecked(false);
		rb_hypoglycemia_3_1.setChecked(false);
		rb_hypoglycemia_3_2.setChecked(false);
		rb_hypoglycemia_3_3.setChecked(false);
		rb_hypoglycemia_4_1.setChecked(false);
		rb_hypoglycemia_4_2.setChecked(false);
		rb_hypoglycemia_4_3.setChecked(false);
		rb_classify_1_1.setChecked(false);
		rb_classify_1_2.setChecked(false);
		rb_classify_1_3.setChecked(false);
		rb_classify_1_4.setChecked(false);
		rb_classify_2_1.setChecked(false);
		rb_classify_2_2.setChecked(false);
		rb_classify_2_3.setChecked(false);
		rb_classify_2_4.setChecked(false);
		rb_classify_3_1.setChecked(false);
		rb_classify_3_2.setChecked(false);
		rb_classify_3_3.setChecked(false);
		rb_classify_3_4.setChecked(false);
		rb_classify_4_1.setChecked(false);
		rb_classify_4_2.setChecked(false);
		rb_classify_4_3.setChecked(false);
		rb_classify_4_4.setChecked(false);
	}
	
	/**
	 * 从数据库中检出数据
	 */
	public void fetchData(){
		ht = new HereTipa(mContext);
		ht.selectNameAndCode(profileId);
		
		diabet1 = new DiabetService(mContext);
		diabet1.selectDiabetService(profileId, 1);
		diabet2 = new DiabetService(mContext);
		diabet2.selectDiabetService(profileId, 2);
		diabet3 = new DiabetService(mContext);
		diabet3.selectDiabetService(profileId, 3);
		diabet4 = new DiabetService(mContext);
		diabet4.selectDiabetService(profileId, 4);
	}
	
	/**
	 * 将view添加到父view中
	 */
	public void setMyView(){
		this.removeAllViews();
		LayoutParams lp = new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
		this.addView(child,lp);
	}
	
	/**
	 * 将整个界面作为一个view对象
	 * @return 整个界面view
	 */
	public View getMyView(){
		return child;
	}
	
	/**
	 * 保存views的值到数据库
	 */
	public void saveViews() {
		String temp = "";
		
		//第一次随访记录
		DiabetService ds1 = new DiabetService(mContext);
		ds1.selectDiabetService(profileId, 1);
		
		temp = et_fbs_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_fbs(Float.parseFloat(temp));
		}
		temp = et_hemoglobin_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_hemoglobin(Float.parseFloat(temp));
		}
		temp = et_acce_exam_time_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_acce_exam_time(temp);
		}
		temp = et_acce_exam_other_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_acce_exam_other(temp);
		}
		if(rb_obedience_1_1.isChecked()==true){
			ds1.setDise_obedience(1);
		}else if(rb_obedience_1_2.isChecked()==true){
			ds1.setDise_obedience(2);
		}else if(rb_obedience_1_3.isChecked()==true){
			ds1.setDise_obedience(3);
		}
		if(rb_untoward_effect_1_1.isChecked()==true){
			ds1.setDise_untoward_effect(1);
		}else if(rb_untoward_effect_1_2.isChecked()==true){
			ds1.setDise_untoward_effect(2);
		}
		if(rb_hypoglycemia_1_1.isChecked()==true){
			ds1.setDise_hypoglycemia(1);
		}else if(rb_hypoglycemia_1_2.isChecked()==true){
			ds1.setDise_hypoglycemia(2);
		}else if(rb_hypoglycemia_1_3.isChecked()==true){
			ds1.setDise_hypoglycemia(3);
		}
		if(rb_classify_1_1.isChecked()==true){
			ds1.setDise_classify(1);
		}else if(rb_classify_1_2.isChecked()==true){
			ds1.setDise_classify(2);
		}else if(rb_classify_1_3.isChecked()==true){
			ds1.setDise_classify(3);
		}else if(rb_classify_1_4.isChecked()==true){
			ds1.setDise_classify(4);
		}
		temp = et_medicine_1_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_medicine_1(temp);
		}
		temp = et_medi_1_usage_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_medi_1_usage(Integer.parseInt(temp));
		}
		temp = et_medi_1_dosage_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_medi_1_dosage(Float.parseFloat(temp));
		}
		temp = et_medicine_2_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_medicine_2(temp);
		}
		temp = et_medi_2_usage_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_medi_2_usage(Integer.parseInt(temp));
		}
		temp = et_medi_2_dosage_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_medi_2_dosage(Float.parseFloat(temp));
		}
		temp = et_medicine_3_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_medicine_3(temp);
		}
		temp = et_medi_3_usage_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_medi_3_usage(Integer.parseInt(temp));
		}
		temp = et_medi_3_dosage_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_medi_3_dosage(Float.parseFloat(temp));
		}
		temp = et_glucokinin_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_glucokinin(temp);
		}
		temp = et_glucokinin_use_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_glucokinin_use(temp);
		}
		temp = et_transfer_reason_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_transfer_reason(temp);
		}
		temp = et_transfer_hospital_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_transfer_hospital(temp);
		}
		temp = et_next_visit_time_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_next_visit_time(temp);
		}
		temp = et_doctor_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_doctor(temp);
		}
		ds1.updateDiabetService(profileId, 1);
		
		//第二次随访记录
		DiabetService ds2 = new DiabetService(mContext);
		ds2.selectDiabetService(profileId, 2);
		
		temp = et_fbs_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_fbs(Float.parseFloat(temp));
		}
		temp = et_hemoglobin_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_hemoglobin(Float.parseFloat(temp));
		}
		temp = et_acce_exam_time_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_acce_exam_time(temp);
		}
		temp = et_acce_exam_other_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_acce_exam_other(temp);
		}
		if(rb_obedience_2_1.isChecked()==true){
			ds2.setDise_obedience(1);
		}else if(rb_obedience_2_2.isChecked()==true){
			ds2.setDise_obedience(2);
		}else if(rb_obedience_2_3.isChecked()==true){
			ds2.setDise_obedience(3);
		}
		if(rb_untoward_effect_2_1.isChecked()==true){
			ds2.setDise_untoward_effect(1);
		}else if(rb_untoward_effect_2_2.isChecked()==true){
			ds2.setDise_untoward_effect(2);
		}
		if(rb_hypoglycemia_2_1.isChecked()==true){
			ds2.setDise_hypoglycemia(1);
		}else if(rb_hypoglycemia_2_2.isChecked()==true){
			ds2.setDise_hypoglycemia(2);
		}else if(rb_hypoglycemia_2_3.isChecked()==true){
			ds2.setDise_hypoglycemia(3);
		}
		if(rb_classify_2_1.isChecked()==true){
			ds2.setDise_classify(1);
		}else if(rb_classify_2_2.isChecked()==true){
			ds2.setDise_classify(2);
		}else if(rb_classify_2_3.isChecked()==true){
			ds2.setDise_classify(3);
		}else if(rb_classify_2_4.isChecked()==true){
			ds2.setDise_classify(4);
		}
		temp = et_medicine_1_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_medicine_1(temp);
		}
		temp = et_medi_1_usage_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_medi_1_usage(Integer.parseInt(temp));
		}
		temp = et_medi_1_dosage_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_medi_1_dosage(Float.parseFloat(temp));
		}
		temp = et_medicine_2_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_medicine_2(temp);
		}
		temp = et_medi_2_usage_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_medi_2_usage(Integer.parseInt(temp));
		}
		temp = et_medi_2_dosage_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_medi_2_dosage(Float.parseFloat(temp));
		}
		temp = et_medicine_3_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_medicine_3(temp);
		}
		temp = et_medi_3_usage_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_medi_3_usage(Integer.parseInt(temp));
		}
		temp = et_medi_3_dosage_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_medi_3_dosage(Float.parseFloat(temp));
		}
		temp = et_glucokinin_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_glucokinin(temp);
		}
		temp = et_glucokinin_use_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_glucokinin_use(temp);
		}
		temp = et_transfer_reason_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_transfer_reason(temp);
		}
		temp = et_transfer_hospital_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_transfer_hospital(temp);
		}
		temp = et_next_visit_time_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_next_visit_time(temp);
		}
		temp = et_doctor_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_doctor(temp);
		}
		ds2.updateDiabetService(profileId, 2);
		
		//第三次随访记录
		DiabetService ds3 = new DiabetService(mContext);
		ds3.selectDiabetService(profileId, 3);
		
		temp = et_fbs_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_fbs(Float.parseFloat(temp));
		}
		temp = et_hemoglobin_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_hemoglobin(Float.parseFloat(temp));
		}
		temp = et_acce_exam_time_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_acce_exam_time(temp);
		}
		temp = et_acce_exam_other_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_acce_exam_other(temp);
		}
		if(rb_obedience_3_1.isChecked()==true){
			ds3.setDise_obedience(1);
		}else if(rb_obedience_3_2.isChecked()==true){
			ds3.setDise_obedience(2);
		}else if(rb_obedience_3_3.isChecked()==true){
			ds3.setDise_obedience(3);
		}
		if(rb_untoward_effect_3_1.isChecked()==true){
			ds3.setDise_untoward_effect(1);
		}else if(rb_untoward_effect_3_2.isChecked()==true){
			ds3.setDise_untoward_effect(2);
		}
		if(rb_hypoglycemia_3_1.isChecked()==true){
			ds3.setDise_hypoglycemia(1);
		}else if(rb_hypoglycemia_3_2.isChecked()==true){
			ds3.setDise_hypoglycemia(2);
		}else if(rb_hypoglycemia_3_3.isChecked()==true){
			ds3.setDise_hypoglycemia(3);
		}
		if(rb_classify_3_1.isChecked()==true){
			ds3.setDise_classify(1);
		}else if(rb_classify_3_2.isChecked()==true){
			ds3.setDise_classify(2);
		}else if(rb_classify_3_3.isChecked()==true){
			ds3.setDise_classify(3);
		}else if(rb_classify_3_4.isChecked()==true){
			ds3.setDise_classify(4);
		}
		temp = et_medicine_1_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_medicine_1(temp);
		}
		temp = et_medi_1_usage_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_medi_1_usage(Integer.parseInt(temp));
		}
		temp = et_medi_1_dosage_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_medi_1_dosage(Float.parseFloat(temp));
		}
		temp = et_medicine_2_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_medicine_2(temp);
		}
		temp = et_medi_2_usage_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_medi_2_usage(Integer.parseInt(temp));
		}
		temp = et_medi_2_dosage_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_medi_2_dosage(Float.parseFloat(temp));
		}
		temp = et_medicine_3_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_medicine_3(temp);
		}
		temp = et_medi_3_usage_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_medi_3_usage(Integer.parseInt(temp));
		}
		temp = et_medi_3_dosage_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_medi_3_dosage(Float.parseFloat(temp));
		}
		temp = et_glucokinin_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_glucokinin(temp);
		}
		temp = et_glucokinin_use_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_glucokinin_use(temp);
		}
		temp = et_transfer_reason_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_transfer_reason(temp);
		}
		temp = et_transfer_hospital_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_transfer_hospital(temp);
		}
		temp = et_next_visit_time_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_next_visit_time(temp);
		}
		temp = et_doctor_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_doctor(temp);
		}
		ds3.updateDiabetService(profileId, 3);
		
		//第四次随访记录
		DiabetService ds4 = new DiabetService(mContext);
		ds4.selectDiabetService(profileId, 4);
		
		temp = et_fbs_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_fbs(Float.parseFloat(temp));
		}
		temp = et_hemoglobin_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_hemoglobin(Float.parseFloat(temp));
		}
		temp = et_acce_exam_time_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_acce_exam_time(temp);
		}
		temp = et_acce_exam_other_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_acce_exam_other(temp);
		}
		if(rb_obedience_4_1.isChecked()==true){
			ds4.setDise_obedience(1);
		}else if(rb_obedience_4_2.isChecked()==true){
			ds4.setDise_obedience(2);
		}else if(rb_obedience_4_3.isChecked()==true){
			ds4.setDise_obedience(3);
		}
		if(rb_untoward_effect_4_1.isChecked()==true){
			ds4.setDise_untoward_effect(1);
		}else if(rb_untoward_effect_4_2.isChecked()==true){
			ds4.setDise_untoward_effect(2);
		}
		if(rb_hypoglycemia_4_1.isChecked()==true){
			ds4.setDise_hypoglycemia(1);
		}else if(rb_hypoglycemia_4_2.isChecked()==true){
			ds4.setDise_hypoglycemia(2);
		}else if(rb_hypoglycemia_4_3.isChecked()==true){
			ds4.setDise_hypoglycemia(3);
		}
		if(rb_classify_4_1.isChecked()==true){
			ds4.setDise_classify(1);
		}else if(rb_classify_4_2.isChecked()==true){
			ds4.setDise_classify(2);
		}else if(rb_classify_4_3.isChecked()==true){
			ds4.setDise_classify(3);
		}else if(rb_classify_4_4.isChecked()==true){
			ds4.setDise_classify(4);
		}
		temp = et_medicine_1_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_medicine_1(temp);
		}
		temp = et_medi_1_usage_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_medi_1_usage(Integer.parseInt(temp));
		}
		temp = et_medi_1_dosage_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_medi_1_dosage(Float.parseFloat(temp));
		}
		temp = et_medicine_2_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_medicine_2(temp);
		}
		temp = et_medi_2_usage_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_medi_2_usage(Integer.parseInt(temp));
		}
		temp = et_medi_2_dosage_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_medi_2_dosage(Float.parseFloat(temp));
		}
		temp = et_medicine_3_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_medicine_3(temp);
		}
		temp = et_medi_3_usage_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_medi_3_usage(Integer.parseInt(temp));
		}
		temp = et_medi_3_dosage_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_medi_3_dosage(Float.parseFloat(temp));
		}
		temp = et_glucokinin_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_glucokinin(temp);
		}
		temp = et_glucokinin_use_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_glucokinin_use(temp);
		}
		temp = et_transfer_reason_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_transfer_reason(temp);
		}
		temp = et_transfer_hospital_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_transfer_hospital(temp);
		}
		temp = et_next_visit_time_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_next_visit_time(temp);
		}
		temp = et_doctor_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_doctor(temp);
		}
		ds4.updateDiabetService(profileId, 4);
		
		
	}

	@Override
	public void onFocusChange(View v, boolean hasFocus) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub

	}

}
